/*
 * main.cpp
 *
 *  Created on: Nov 8, 2012
 *      Author: Scorpion
 */
#include "FtpAdapter.h"
#include "LocAdapter.h"
#include <iostream>
using namespace std;
using namespace centny;
using namespace centny::file;
extern "C" {
int umain(void);
}
string tname() {
	time_t t = time(0);
	stringstream ss;
	ss << t << ".txt";
	return ss.str();
}
int main(int argc, char** argv) {
	if (0) {
		LocAdapter la("/Users/Scorpion/Centny/Tools/IOS/");
		FInfo *lfi = la.finfo();
		lfi->showAll();
		umain();
		return 1;
	}
	CurlBuilder::init();
	CurlBuilder curl;
	curl.showDebug(1L);
//	string query = "<?xml version='1.0' encoding='UTF-8'?>\r\n"
//			"<d:propfind xmlns:d='DAV:'>\r\n"
//			"<d:prop><d:getcontenttype/></d:prop>\r\n"
//			"<d:prop><d:getcontentlength/></d:prop>\r\n"
//			"</d:propfind>\r\n";
//	string request = "PROPFIND /webdav/ HTTP/1.1\r\n" "Depth: 1\r\n"
//			"Host: mydisk.se:80\r\n" "Accept: */*\r\n"
//			"Content-Type: text/xml\r\n" "Content-Length:0 "
//			"\r\nWWW-Authorization: Basic U2NvOnNjbwo=\r\n\r\n";
//	curl.appHeader("Authorization: Basic U2NvOnNjbwo=");
//	curl.appHeader("Content-Type: text/xml; charset=\"utf-8\"");
//	curl.setURL("http://localhost/webdav/");
//	curl.setUsrPwd("sco:Scos");
//	curl.setOpt(CURLINFO_HTTPAUTH_AVAIL, request.c_str());
	curl.perform();
	if (1)
		return 1;
	FtpAdapter ca;
//	ca.rurl = "ftp://10.211.55.10";
	ca.usrpwd = "sco:sco";
//	ca.finfo()->showAll();
	NetFInfo *fi = (NetFInfo*) ca.finfo();
	fi->upload("/tmp/u.txt", tname());
	fi->subs();
	NetFInfo *wfi = (NetFInfo*) ca.finfo("/www");
	wfi->upload("/tmp/u.txt", tname());
	CurlBuilder::clean();
	cout << "all end" << endl;
	return 1;
}

